package cate.game.play.skill.active;

import cate.common.table.d.GDHero;
import cate.common.util.XT;
import cate.game.play.base.TargetFilterParam;
import cate.game.play.base.TargetSelector;
import cate.game.play.config.PlayCfgArgs;
import cate.game.play.fighter.Fighter;
import cate.game.play.proce.action.ctx.SkillActionCtx;

import java.util.List;

/**
 * 并对敌方随机3个单位附加以下三种状态中的一种：【禁止复活】、【禁疗】、【破甲】；额外对坦克附加【虚化】
 */
public class 黄泉弦音AH extends ActiveHandler{

	private int 人数;

	private List<Integer> 随机buff;

	private int 坦克buff;

	//人数=？？&随机buff=??#??#??&坦克buff=？？
	@Override
	public void parse(String code) {
		PlayCfgArgs args = new PlayCfgArgs(code);
		人数 = args.getInt("人数", 0);
		随机buff = args.getIntList("随机buff");
		坦克buff = args.getInt("坦克buff", 0);
	}

	@Override
	public void onSkillDone(SkillActionCtx action) {
		TargetFilterParam param = new TargetFilterParam();
		param.targetNumSet(人数);
		List<Fighter> targets = TargetSelector.doFind(skill.owner, action.getTeamVs(), param);
		for (Fighter target : targets) {
			if (XT.isNotBlank(随机buff)) {
				int buff = 随机buff.get(XT.randomIndex(随机buff.size()));
				target.buff.tryAddByTid(action, skill.owner, buff);
			}
			if (坦克buff > 0 && target.getJob() == GDHero.Job.J3) {
				target.buff.tryAddByTid(action, skill.owner, 坦克buff);
			}
		}
	}
}
